package com.ouyu.mvc.controller;


import com.ouyu.mvc.dao.TestDao;
import com.ouyu.mvc.selfAnnotation.JAutoWrite;
import com.ouyu.mvc.selfAnnotation.JController;
import com.ouyu.mvc.selfAnnotation.JResponseBody;
import com.ouyu.mvc.selfAnnotation.JRequestMapping;
import com.ouyu.mvc.vo.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ouyu
 * Date: 2018-10-24
 * Time: 15:00
 */
@JRequestMapping("/demo")
@JController("demoController")
public class DemoController {

    @JAutoWrite("testDao")
    TestDao testDao;

    @JRequestMapping("/test")
    @JResponseBody
    public List<User> test(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        response.getWriter().print("{\"data\":\"success\"}");
        List<User> rs=testDao.getUser();
        return rs;
        //return JSON.parseObject("{\"data\":\"success\"}");
        //System.out.println("test success!"+request.getRequestURI());


    }
}
